import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2023-04-26
 * Time: 16:04
 */
public class DataInFormatCheck {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        boolean flag = true;
        while (flag){
            try {
                System.out.println("请输入一个浮点数");
                double num = scan.nextDouble();
                System.out.println("num");
                flag = false;
            }catch (Exception e){
                System.out.println("异常类型："+ e.toString());
                flag = true;
                scan.next();
            }finally {
                System.gc();
                System.out.println("释放内存");
            }
        }
        scan.close();
    }
}
